package cn.hc.mq.boot.consumer;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import java.nio.charset.Charset;

/**
 * @author huangchao E-mail:fengquan8866@163.com
 * @version 创建时间：2024/8/28 23:03
 */
@Component
@RocketMQMessageListener(consumerGroup = "boot-consumer2", topic = "helloBoot")
@Slf4j
public class HelloBootGroup2Listener implements RocketMQListener<MessageExt> {
    @Override
    public void onMessage(MessageExt messageExt) {
        log.info("收到的消息HelloBootGroup2Listener: {}", new String(messageExt.getBody(), Charset.defaultCharset()));
    }
}
